package com.bbva.kyfb.kyfbjpatlsb.dominiotlsb;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Embeddable;

import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.roo.addon.entity.RooIdentifier;

import flexjson.JSONDeserializer;
import flexjson.JSONSerializer;

/**
 * The Class TbduefesPK.
 */
@Configurable
@Embeddable
@RooIdentifier(dbManaged = true)
public final class TbduefesPK implements java.io.Serializable, org.springframework.beans.factory.aspectj.ConfigurableObject {

	/**
	 * To json.
	 *
	 * @return the string
	 */
	public String toJson() {
        return new JSONSerializer().exclude("*.class").serialize(this);
    }

	/**
	 * From json to tbduefes pk.
	 *
	 * @param json the json
	 * @return the tbduefes pk
	 */
	public static TbduefesPK fromJsonToTbduefesPK(String json) {
        return new JSONDeserializer<TbduefesPK>().use(null, TbduefesPK.class).deserialize(json);
    }

	/**
	 * To json array.
	 *
	 * @param collection the collection
	 * @return the string
	 */
	public static String toJsonArray(Collection<TbduefesPK> collection) {
        return new JSONSerializer().exclude("*.class").serialize(collection);
    }

	/**
	 * From json array to tbduefes p ks.
	 *
	 * @param json the json
	 * @return the collection
	 */
	public static Collection<TbduefesPK> fromJsonArrayToTbduefesPKs(String json) {
        return new JSONDeserializer<List<TbduefesPK>>().use(null, ArrayList.class).use("values", TbduefesPK.class).deserialize(json);
    }

	/** The cod canaldi. */
	@Column(name = "COD_CANALDI", columnDefinition = "SMALLINT", nullable = false)
    private Short codCanaldi;

	/** The cod bancoint. */
	@Column(name = "COD_BANCOINT", columnDefinition = "SMALLINT", nullable = false)
    private Short codBancoint;

	/** The cod logonapl. */
	@Column(name = "COD_LOGONAPL", columnDefinition = "CHAR", nullable = false, length = 20)
    private String codLogonapl;

	/** The cod bancopr. */
	@Column(name = "COD_BANCOPR", columnDefinition = "SMALLINT", nullable = false)
    private Short codBancopr;

	/** The cod prodserv. */
	@Column(name = "COD_PRODSERV", columnDefinition = "SMALLINT", nullable = false)
    private Short codProdserv;

	/** The cod subprodu. */
	@Column(name = "COD_SUBPRODU", columnDefinition = "SMALLINT", nullable = false)
    private Short codSubprodu;

	/** The cod usuario. */
	@Column(name = "COD_USUARIO", columnDefinition = "CHAR", nullable = false, length = 8)
    private String codUsuario;

	/** The cod sespau. */
	@Column(name = "COD_SESPAU", columnDefinition = "CHAR", nullable = false, length = 64)
    private String codSespau;

	/**
	 * Instantiates a new tbduefes pk.
	 *
	 * @param codCanaldi the cod canaldi
	 * @param codBancoint the cod bancoint
	 * @param codLogonapl the cod logonapl
	 * @param codBancopr the cod bancopr
	 * @param codProdserv the cod prodserv
	 * @param codSubprodu the cod subprodu
	 * @param codUsuario the cod usuario
	 * @param codSespau the cod sespau
	 */
	public TbduefesPK(Short codCanaldi, Short codBancoint, String codLogonapl, Short codBancopr, Short codProdserv, Short codSubprodu, String codUsuario, String codSespau) {
        super();
        this.codCanaldi = codCanaldi;
        this.codBancoint = codBancoint;
        this.codLogonapl = codLogonapl;
        this.codBancopr = codBancopr;
        this.codProdserv = codProdserv;
        this.codSubprodu = codSubprodu;
        this.codUsuario = codUsuario;
        this.codSespau = codSespau;
    }

	/**
	 * Instantiates a new tbduefes pk.
	 */
	@SuppressWarnings("unused")
	private TbduefesPK() {
        super();
    }

	/**
	 * Gets the cod canaldi.
	 *
	 * @return the cod canaldi
	 */
	public Short getCodCanaldi() {
        return this.codCanaldi;
    }

	/**
	 * Gets the cod bancoint.
	 *
	 * @return the cod bancoint
	 */
	public Short getCodBancoint() {
        return this.codBancoint;
    }

	/**
	 * Gets the cod logonapl.
	 *
	 * @return the cod logonapl
	 */
	public String getCodLogonapl() {
        return this.codLogonapl;
    }

	/**
	 * Gets the cod bancopr.
	 *
	 * @return the cod bancopr
	 */
	public Short getCodBancopr() {
        return this.codBancopr;
    }

	/**
	 * Gets the cod prodserv.
	 *
	 * @return the cod prodserv
	 */
	public Short getCodProdserv() {
        return this.codProdserv;
    }

	/**
	 * Gets the cod subprodu.
	 *
	 * @return the cod subprodu
	 */
	public Short getCodSubprodu() {
        return this.codSubprodu;
    }

	/**
	 * Gets the cod usuario.
	 *
	 * @return the cod usuario
	 */
	public String getCodUsuario() {
        return this.codUsuario;
    }

	/**
	 * Gets the cod sespau.
	 *
	 * @return the cod sespau
	 */
	public String getCodSespau() {
        return this.codSespau;
    }

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null) return false;
        if (!(obj instanceof TbduefesPK)) return false;
        TbduefesPK other = (TbduefesPK) obj;
        if (codCanaldi == null) {
            if (other.codCanaldi != null) return false;
        } else if (!codCanaldi.equals(other.codCanaldi)) return false;
        if (codBancoint == null) {
            if (other.codBancoint != null) return false;
        } else if (!codBancoint.equals(other.codBancoint)) return false;
        if (codLogonapl == null) {
            if (other.codLogonapl != null) return false;
        } else if (!codLogonapl.equals(other.codLogonapl)) return false;
        if (codBancopr == null) {
            if (other.codBancopr != null) return false;
        } else if (!codBancopr.equals(other.codBancopr)) return false;
        if (codProdserv == null) {
            if (other.codProdserv != null) return false;
        } else if (!codProdserv.equals(other.codProdserv)) return false;
        if (codSubprodu == null) {
            if (other.codSubprodu != null) return false;
        } else if (!codSubprodu.equals(other.codSubprodu)) return false;
        if (codUsuario == null) {
            if (other.codUsuario != null) return false;
        } else if (!codUsuario.equals(other.codUsuario)) return false;
        if (codSespau == null) {
            if (other.codSespau != null) return false;
        } else if (!codSespau.equals(other.codSespau)) return false;
        return true;
    }

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
        final int prime = 31;
        int result = 17;
        result = prime * result + (codCanaldi == null ? 0 : codCanaldi.hashCode());
        result = prime * result + (codBancoint == null ? 0 : codBancoint.hashCode());
        result = prime * result + (codLogonapl == null ? 0 : codLogonapl.hashCode());
        result = prime * result + (codBancopr == null ? 0 : codBancopr.hashCode());
        result = prime * result + (codProdserv == null ? 0 : codProdserv.hashCode());
        result = prime * result + (codSubprodu == null ? 0 : codSubprodu.hashCode());
        result = prime * result + (codUsuario == null ? 0 : codUsuario.hashCode());
        result = prime * result + (codSespau == null ? 0 : codSespau.hashCode());
        return result;
    }

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = 1L;
}
